<script>

    jxt.project_experience.add = function (eleid) {
        var n = jxt.getnode(eleid);
        var arr = jxt.project_experience.getdata(eleid);
        if(!arr)arr=[];
        arr.push( { starttime:'',endtime:'',project_name:'',software_environment:"",development_tool:"",responsibility:""  } );

        n.content = arr;
        jxt.msg.radio(eleid, "nodechange");
        jxt.tag.render(n,true);
    };
    jxt.project_experience.delrow = function (eleid, i) {
        var n = jxt.getnode(eleid);
        var arr = jxt.project_experience.getdata(eleid);
        arr.splice(i, 1);
        n.content = arr;
        jxt.msg.radio(eleid, "nodechange");
        jxt.tag.render(n, true);
    };
    jxt.project_experience.getdata=function (eleid) {
        var arr = [];
        var starttime_arr = $("input[data-jxt-data='"+eleid +"_starttime']");
        var endtime_arr = $("input[data-jxt-data='"+eleid +"_endtime']");
        var project_name_arr = $("input[data-jxt-data='"+eleid +"_project_name']");
        var software_environment_arr = $("input[data-jxt-data='"+eleid +"_software_environment']");
        var development_tool_arr = $("input[data-jxt-data='"+eleid +"_development_tool']");
        var responsibility_arr = $("textarea[data-jxt-data='"+eleid +"_responsibility']");
        for(var i=0;i<starttime_arr.length;i++){
            arr.push( { starttime:$(starttime_arr[i]).val().trim(),endtime:$(endtime_arr[i]).val().trim(),
                project_name:$(project_name_arr[i]).val().trim(),software_environment:$(software_environment_arr[i]).val().trim(),
                development_tool:$(development_tool_arr[i]).val().trim() ,responsibility:$(responsibility_arr[i]).val().trim() } );
        }
        return arr;
    };

    jxt.project_experience.ok = function (eleid) {

        var n = jxt.getnode(eleid);
        var arr=jxt.project_experience.getdata(eleid);
        if(arr && arr.length>0){
            n.content = arr;
            jxt.msg.radio(eleid, "nodechange");
        }

        jxt.tag.ok(eleid);
    };


    jxt.project_experience.create = function (subscribe_id, eventkey, attrs, event_source_id) {
        var node = jxt.newJson(subscribe_id);
        if (attrs && attrs.tpname) {
            node.tpname = attrs.tpname;
        }
        jxt.msg.radio("project_experience", "addmainnode", {"newnodelist": node});
        jxt.route.exe('project_experience.editbegin', null, node.id);

    };

    jxt.msg.subscribe("project_experience", "createproject_experience", 'project_experience.create');

</script>